<!--自定义复制-->
<template>
  <span class="customCopyWrapper" @click="initCopy()">
    <Copy />
  </span>
</template>

<script lang="ts">
import { Component, Vue, Prop } from 'nuxt-property-decorator'
import { CustomClipboard } from '~/utils/copy'
import { ICopyConfig } from '~/components/common/types'
import Copy from './Copy.vue'
@Component({
  components: {
    Copy,
  },
})
export default class CustomCopy extends Vue {
  @Prop({ type: Object, default: () => ({}) })
  copyConfig!: ICopyConfig

  initCopy() {
    // eslint-disable-next-line no-new
    new CustomClipboard(this.copyConfig.copyText, '.customCopyWrapper').copy()
  }
}
</script>

<style lang="scss" scoped>
.customCopyWrapper {
  cursor: pointer;
}
</style>
